#ifndef CLASS_TCP_H
#define CLASS_TCP_H

#include <iostream>
#include <vector>
#include <unordered_map>
#include <memory>
#include <string>
#include <cstring>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/epoll.h>
#include <fcntl.h>
#include <vector>

using namespace std;

class class_client
{
public:
    class_client();
    int client_fd;
    char client_ip[INET_ADDRSTRLEN];
    uint16_t client_port;
};

class class_TCP
{
public:
    class_TCP();
    int run;
    int initTCPserver();
    void runTCPserver();

private:
    size_t max_connections_;
    int epoll_fd_;
    int server_fd_;

    void handleNewConnection();
    void handleClientEvent(int fd, uint32_t events);
    void handleData(char* data,ssize_t bytes_read,int i_d);
    vector<class_client*> vec_clients;

};

#endif // CLASS_TCP_H
